package cn.yangliu.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;

/**
 * @author 问道于盲
 * @date 2021-09-27
 */
@MappedSuperclass
@Data
public class AbstractEntity implements Serializable {

    private static final long serialVersionUID = 889334542450926411L;

    /**
     * id
     */
    @Id
    @JSONField(serializeUsing= ToStringSerializer.class)
    @GeneratedValue(generator = "snowflakeId")
    @GenericGenerator(name = "snowflakeId", strategy = "cn.yangliu.tools.SnowflakeIdGenerator")
    private Long id;

    /**
     * 描述
     */
    private String description;

}
